//
//  LYDayRightTableViewCell.m
//  MusicMV
//
//  Created by dllo on 16/3/22.
//  Copyright © 2016年 Eternity. All rights reserved.
//

#import "LYDayRightTableViewCell.h"
#import "LYDayRightModel.h"
@interface LYDayRightTableViewCell ()

@property (nonatomic, retain) UIImageView *imgView; /**< 图片 */
@property (nonatomic, retain) UILabel *titleLabel; /**< 标题 */
@property (nonatomic, retain) UILabel *hotLabel; /**< 热度 */

@end
@implementation LYDayRightTableViewCell


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
       
        [self createView];
        
    }
    return self;
}



- (void)setModel:(LYDayRightModel *)model {
    _model = model;
    
    [self.imgView sd_setImageWithURL:[NSURL URLWithString:model.small_pic_url]];
    
    self.titleLabel.text = model.tag_name;
    
    self.hotLabel.text = [NSString stringWithFormat:@"试听热度: %@", model.listen_count];
    self.hotLabel.font = [UIFont systemFontOfSize:14];
    self.hotLabel.textColor = [UIColor lightGrayColor];
    
    
}
- (void)createView {
    
    self.imgView = [[UIImageView alloc] init];
    [self.contentView addSubview:_imgView];
    
    self.titleLabel = [[UILabel alloc] init];
    [self.contentView addSubview:_titleLabel];
    
    self.hotLabel = [[UILabel alloc] init];
    [self.contentView addSubview:_hotLabel];
    
    self.img = [[UIImageView alloc] init];
    [self.contentView addSubview:_img];
    
}

- (void)layoutSubviews {
    [super layoutSubviews];
    
    _imgView.frame = CGRectMake(5 * wt, 25 * ht, 90 * wt, 90 * wt);
    
    
    _titleLabel.frame = CGRectMake(_imgView.frame.size.width + _imgView.frame.origin.x + 10  * wt, 25 * ht, 100 * wt, 40 * ht);
    
    _hotLabel.frame = CGRectMake(_imgView.frame.size.width + _imgView.frame.origin.x + 10  * wt, _titleLabel.frame.size.height + _titleLabel.frame.origin.y + 20 * ht, 200 * ht, 30 * ht);
    
    _img.frame = CGRectMake(self.contentView.frame.size.width - 40 * wt, self.contentView.frame.size.height - 110 * ht, 40 * wt, 40 * wt);
    _img.layer.cornerRadius = 20 * wt;
    _img.layer.masksToBounds = YES;
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
